package com.naiterui.ehp.bs.doctor.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.doctor.service.AdVersionService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author luao
 * @date 2022/4/2 2:02 PM
 **/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("ad/inner/version")
@Api(tags = {SwaggerTag.DOCTOR + SwaggerTag.INNER_API + SwaggerTag.VERSION_CONTROL})
public class AdInnerVersionController {

    private final AdVersionService adVersionService;

    @PostMapping("saveVersion")
    @ResponseBody
    public void save(Integer appPlat, String lastVerNum, String lastVerSize, Integer result, String forceVersion,
        String content, String url) throws BusinessException {
        log.info("输入平台:" + appPlat + ",最新版本号:" + lastVerNum + ",最新版本大小:" + lastVerSize + ",被更新版本号:" + forceVersion
            + ",更新提示语:" + content + ",更新跳转地址:" + url);
        adVersionService.saveVersion(appPlat, lastVerNum, lastVerSize, result, forceVersion, content, url);
    }
}
